package de.hu.wbi.histoner;

import java.util.Comparator;

/**
Copyright 2011,2012 Philippe Thomas
This file is part of histoner.

HistoNer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.

HistoNer  is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with HistoNer .  If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * Sort two strings by length
 * @author philippe
 * @version 1.0
 */
public class StringlengthComparator implements Comparator<String> {

	@Override
	public int compare(String o1, String o2) {

		if(o1.length() < o2.length())
			return -1;
		
		if(o1.length() > o2.length())
			return 1;
		
		else
			return o1.compareTo(o2);
	}
}
